1. Technical Field
The present disclosure generally relates to software debuggers and methods of debugging software, and more particularly to a debugger and a debugging method that uses conditional breakpoints.
2. Discussion of Related Art
A debugger or a debugging tool is a computer program that is used to test and debug a target program. A “crash” may happen when the target program cannot normally continue because of a programming bug. For example, the program may have attempted to use an unavailable instruction or to access unavailable or protected memory. When the program “crashes” or reaches a preset condition, the debugger may show the position in the original code if it is a source-level debugger or symbolic debugger.
Debuggers may also offer more sophisticated functions such as running a program step by step (single-stepping), or by stopping or pausing (breaking) the program to examine the current state at some event or specified instruction by means of a breakpoint. A breakpoint can be absolute or conditional. An absolute breakpoint may identify a line number within a target program where a break in the execution of the program will occur when that line has been reached. A conditional breakpoint additionally includes a condition that needs to be satisfied before the break occurs. For example, the breakpoint could be conditioned on a variable of the program having a certain value.
When debugging object-oriented and imperative software, one is often interested in focusing on the behavior of a piece of code with respect to some specific data entity with which the code interacts. For example, it may be important to focus on behavior with respect to data entities that belong to some other piece of code, by virtue of being allocated at some particular program point. However, this focus cannot be achieved with ordinary conditional breakpoints, because the point at which an object was allocated cannot be identified by examining the object. Further, achieving this focus can be particularly challenging when debugging software that makes use of a complex software framework.
A software framework is an abstraction in which common code providing generic functionality can be selectively overridden or specialized by user code, thus providing specific functionality. Frameworks are a special case of software libraries in that they are reusable abstractions of code wrapped in a well-defined Application Programming Interface (API), yet they contain some distinguishing features that separate them from normal libraries. For example, a framework may have a default behavior, be non-modifiable, have inversion of control, or extensibility. Inversion of control allows the overall program's flow of control to be dictated by the framework instead of the caller. Extensibility allows a framework to be extended due to selective overriding by a user or specialized by user code providing a specific functionality.
Developers debugging software that uses a given framework may resort to tracing through the framework to understand the framework's behavior, and how it relates to their code. Unfortunately, setting a breakpoint at a particular line of source code within a framework often results in the debugger stopping many times at that line, on behalf of entities created or owned by framework clients other than the one of interest. As a result, it can become difficult to focus on the interactions between client code and framework code.